<template>
  <div class="navBar">
      <div class="left" @click="leftEvent">
          <span v-if="!$slots.left">{{leftText}}</span>
          <slot name="left"></slot>
      </div>
      <h1 class="title">{{title}}</h1>
      <div class="righ" @click="rightEvent">
          <span  v-if="!$slots.right">{{rightText}}</span>
          <slot name="right"></slot>
      </div>
  </div>
</template>

<script>
export default {
    props: {
        title: {
            type: String,
            default: '标题'
        },
        'left-text': {
            type: String,
            default: ''
        },
        'left-arrow': {
            type: Boolean,
            default: false
        },
        'right-text': {
            type: String,
            default: ''
        }
    },
    methods: {
        leftEvent() {
            this.$emit('left-click')
        },
        rightEvent() {
            this.$emit('right-click')
        }
    }
}
</script>

<style lang="scss" scoped>
div{
    padding: 0;
    margin: 0;
    box-sizing: border-box;
}
.navBar{
    width: 100%;
    height: 50px;
    display: flex;
    padding: 0 20px;
    align-items: center;
    justify-content: space-between;
    .title{
        font-size: 16px;
        font-weight: 500;
    }
}
</style>
